Skip to main content

Overview

This module defines the fundamental types, structures, and enumerations used throughout PVAC-HFHE, including cryptographic keys, ciphertexts, parameters, and graph structures for homomorphic operations.

Structures

Params

Parameters controlling the security and performance of the PVAC-HFHE scheme.
int
default:"337"
Multiplicative group carrier for homomorphic properties
int
default:"8192"
Dimension parameter m in bits
int
default:"16384"
Dimension parameter n in bits
int
default:"192"
Column weight for H matrix
int
default:"128"
Column weight for x matrix
int
default:"128"
Error weight parameter
double
default:"120.0"
Noise entropy in bits for security
double
default:"0.55"
Fraction parameter for tuple generation
double
default:"16.0"
Depth slope parameter in bits
size_t
default:"1200000"
Maximum number of edges in computation graph
int
default:"4096"
LPN dimension parameter
int
default:"16384"
LPN sample count parameter
int
default:"1"
LPN noise rate numerator (τ = lpn_tau_num / lpn_tau_den)
int
default:"8"
LPN noise rate denominator (τ = 1/8)
double
default:"0.48"
Lower bound for recryption threshold
double
default:"0.52"
Upper bound for recryption threshold
int
default:"8"
Number of recryption rounds
The default parameters provide:
  • Information-theoretic security: 2226 bits
  • Classical security: 200+ bits
  • Quantum security: 100+ bits

Fp

Field element represented as a 127-bit integer using two 64-bit words.
uint64_t
Low 64 bits of the field element
uint64_t
High 63 bits of the field element (top bit unused)
Fp represents elements in the field modulo 2^127 - 1 (Mersenne prime p = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF).

PubKey

Public key for encryption and evaluation.
Params
Scheme parameters
uint64_t
Canonical tag for key identification
std::vector<BitVec>
Public matrix H for LPN-based encryption
Ubk
Permutation data for universal broadcast
std::array<uint8_t, 32>
SHA-256 digest of matrix H
Fp
B-th root of unity in the field
std::vector<Fp>
Precomputed powers for evaluation

SecKey

Secret key for decryption.
std::array<uint64_t, 4>
PRF key for pseudorandom generation (256 bits)
std::vector<uint64_t>
LPN secret vector in packed bit format

Cipher

Ciphertext structure representing encrypted data and computation graph.
std::vector<Layer>
Computation layers in the DAG
std::vector<Edge>
Edges connecting layers in the computation graph
std::vector<Fp>
Base ciphertext vector
size_t
default:"1"
Number of message slots (for batching)

Layer

Computation layer in the evaluation graph.
RRule
Computation rule type (BASE or PROD)
RSeed
Random seed for deterministic randomness expansion
uint32_t
Parent index A
uint32_t
Parent index B

Edge

Edge in the computation graph with associated weights.
uint32_t
Index of the layer this edge connects to
uint16_t
Edge index within the layer
uint8_t
Sign/channel indicator (SGN_P or SGN_M)
std::vector<Fp>
Weight vector in the field
BitVec
Binary selection vector

EvalKey

Evaluation key for homomorphic operations.
std::vector<Cipher>
Pool of zero encryptions for noise refreshing
Cipher
Encryption of the value 1

Nonce128

128-bit nonce for randomization.
uint64_t
Low 64 bits
uint64_t
High 64 bits

RSeed

Random seed structure.
uint64_t
Tag for domain separation
Nonce128
128-bit nonce

Ubk

Permutation data for universal broadcast key.
std::vector<int>
Permutation array
std::vector<int>
Inverse permutation array

Enumerations

RRule

Computation rule type for layers.
0
Base layer (input)
1
Product layer (multiplication)

EdgeSign

Sign indicator for edges.
0
Positive sign
1
Negative sign (minus)

Functions

make_nonce128

Generates a random 128-bit nonce.
Nonce128
Cryptographically secure random nonce

sgn_val

Converts edge sign to integer value.
uint8_t
Edge sign (SGN_P or SGN_M)
int
Returns +1 for SGN_P, -1 for SGN_M

rand_fp_nonzero

Generates a random non-zero field element.
Fp
Random non-zero field element
This function loops until a non-zero element is generated.

Domain Separation Constants

The Dom namespace provides string constants for domain separation in cryptographic operations:
These domain separation constants are critical for security. Never modify them unless you fully understand the cryptographic implications.